//#include "StdAfx.h"
#include "TrainingCaseDB.h"
#include <math.h>

CTrainingCaseDB::CTrainingCaseDB(void)
{
	m_tTrainingCases = NULL;
}


CTrainingCaseDB::~CTrainingCaseDB(void)
{
	if( m_tTrainingCases )
	{
		for( int i=0; i<MAX_CASE; i++ )
			delete m_tTrainingCases[i];
		delete []m_tTrainingCases;
	}
}

void CTrainingCaseDB::BuildAllCase( void )
{
	int nIdx = 0;
	m_tTrainingCases = new CTrainingCase* [ MAX_CASE ];

	for( int d0=0; d0<EOBJTYPE_ALL; d0++ )
	for( int d1=0; d1<EOBJTYPE_ALL; d1++ )
	for( int d2=0; d2<EOBJTYPE_ALL; d2++ )
	for( int d3=0; d3<EOBJTYPE_ALL; d3++ )
	{
		EOBJTYPE tEnvRoundMe[ ALL_DIRECTION_COUNT ];
		tEnvRoundMe[ DIR_UP ] = (EOBJTYPE) d0;
		tEnvRoundMe[ DIR_LEFT ] = (EOBJTYPE) d1;
		tEnvRoundMe[ DIR_RIGHT ] = (EOBJTYPE) d2;
		tEnvRoundMe[ DIR_DOWN ] = (EOBJTYPE) d3;

		m_tTrainingCases[nIdx] = new CTrainingCase( tEnvRoundMe, nIdx );
		nIdx++;
		//TRACE( "index = %d, %d\n", nIdx,(int) pow( (float)3 , 8)  );
	}
}

CTrainingCase* CTrainingCaseDB::GetCase( int nIndex )
{
	return m_tTrainingCases[nIndex];
}
